<!doctype html>

<head>
    <title>可靠性在线工具</title>
    
    <style type="text/css">
        body,input {font-family:Microsoft YaHei;font-size:100%}
    </style>
    <script src="{{ url_for('static', filename='jquery-3.3.1.js') }}"></script>
    <script type="text/javascript">
        function check_null(value, alerttxt)
        {
            if (value != "")
            {
                return true;
            }
            else
            {
                alert(alerttxt);
                return false;
            }
        }
        function checkLoginW3(){
            var input_w3name = document.getElementById("w3name")
            var val_w3name = input_w3name.value
            if (check_null(val_w3name, "w3name null!"))
            {
                // TODO:正则校验
                if (false)
                {
                    input_w3name.focus();
                    return false;
                }
            }
            else
            {
                input_w3name.focus();
                return false;
            }
            
            var input_w3pwd = document.getElementById("w3pwd")
            var val_w3pwd = input_w3pwd.value
            if (!check_null(val_w3pwd, "w3pwd null!"))
            {
                input_w3pwd.focus();
                return false;
            }
            
            return true;
        }

        function submitVersionAnalyse(){
            <!-- var input_version = document.getElementById("version") -->
            <!-- var val_version = input_version.value -->
            <!-- if (!check_null(val_version, "version null!")) -->
            <!-- { -->
                <!-- input_version.focus(); -->
                <!-- return; -->
            <!-- } -->
            
            <!-- document.formapr.action="/get_report"; -->
            <!-- document.formapr.submit(); -->
            return;
        }
        function submitVersionState(){
            <!-- var input_version = document.getElementById("version") -->
            <!-- var val_version = input_version.value -->
            <!-- if (!check_null(val_version, "version null!")) -->
            <!-- { -->
                <!-- input_version.focus(); -->
                <!-- return; -->
            <!-- } -->
            
            <!-- document.formapr.action="/get_report"; -->
            <!-- document.formapr.submit(); -->
            return;
        }
        function submitSNHistory(){
            <!-- var input_version = document.getElementById("version") -->
            <!-- var val_version = input_version.value -->
            <!-- if (!check_null(val_version, "version null!")) -->
            <!-- { -->
                <!-- input_version.focus(); -->
                <!-- return; -->
            <!-- } -->
            
            <!-- document.formapr.action="/get_report"; -->
            <!-- document.formapr.submit(); -->
            return;
        }
        function submitEventHistory(){
            <!-- var input_version = document.getElementById("version") -->
            <!-- var val_version = input_version.value -->
            <!-- if (!check_null(val_version, "version null!")) -->
            <!-- { -->
                <!-- input_version.focus(); -->
                <!-- return; -->
            <!-- } -->
            
            <!-- document.formapr.action="/get_report"; -->
            <!-- document.formapr.submit(); -->
            <!-- return; -->
        }
        function submitVersionReport(){
            var input_version = $('#version')
            var val_version = input_version.val()
            if (!check_null(val_version, "version null!"))
            {
                input_version.focus();
                return;
            }
            
            $.post('/get_report', {
                version: val_version
            },
                function (data, status) {
                alert("Data: " + data + "\nStatus: " + status);
            })
        }

        function submitSuggest(){
            var input_suggest = $('#suggest')
            var val_suggest = input_suggest.val()
            if (!check_null(val_suggest, "suggest null!"))
            {
                input_suggest.focus();
                return;
            }
            
            $.post('/suggest', {
                suggest: val_suggest
            },
                function (data, status) {
                alert("Data: " + data + "\nStatus: " + status);
            })
        }
    </script>
</head>

<body>
{% with messages = get_flashed_messages() %}
    {% if messages %}
    <ul style="color:red">
        {% for message in messages %}
        <li>{{ message }}</li>
        {% endfor %}
    </ul>
    {% endif %}
{% endwith %}
{% if error %}
    <p style="color:red">{{ error }}</p>
{% endif %}
    <table border=0 width=80% align=center>
        <tr bgcolor=#4CB4E7>
            <td>
                <a href=/>回到首页</a>
            </td>
{% if username %}
            <td align=right>
                Hello {{ username }}! <a href="/logout">登出</a>
            </td>
{% else %}
            <td colspan=2>
                <form action="/login" method="post" onsubmit="return checkLoginW3();">
                    W3账号<input type=text id=w3name name=w3name id=w3name>
                    W3密码<input type=password id=w3pwd name=w3pwd id=w3pwd>
                    <input type=submit value=登录>
                </form>
            </td>
{% endif %}
        </tr>
        <!-- ################################# APR分析备注 ################################# -->
        <tr>
            <th width=20% align=left>Beta APR</th>
            <td>
                <a href=#>自动分析</a>
                <a href=#>查询分析率</a>
                <a href=#>查询SN</a>
                <a href=#>查询类型</a>
                <a href=#>获取报告</a>
            </td>
        <tr>

        <!-- ################################# BETA问题(/FUT/维修工单) ################################# -->
        <tr>
            <th align=left>BETA/FUT/维修工单</th>
            <td>
                <a href=#>f1</a>
                <a href=#>f2</a>
                <a href=#>查询SN</a>
                <a href=#>查询类型</a>
                <a href=#>获取报告</a>
            </td>
        <tr>

        <!-- ################################# 舆情/NPS/满意度 ################################# -->
        <tr>
            <th align=left>舆情/NPS/满意度</th>
            <td>
                <a href=#>f1</a>
                <a href=#>f2</a>
                <a href=#>f3</a>
                <a href=#>f4</a>
                <a href=#>获取报告</a>
            </td>
        <tr>

        <tr bgcolor=#FAEE93>
            <th>
                新增任务
            </th>
            <th>
                现有任务
            </th>
        </tr>
        <tr>
            <td>
{% if task_name %}
                <h1>{{ task_name }}</h1>
{% endif %}
                产品<input type=text name=product id=product>
                版本<input type=text name=version id=version>
                问题类型<input type=text name=eventtype id=eventtype>
                SN<input type=text name=sn id=sn>
                <input type=submit value=提交 onclick="submitSuggest()">
            </td>
            <td align=right>
                <div style="height:300px;overflow-y:scroll;text-align:left">
                    小小程序员<br/>
                    小小程序员<br/>
                    小小程序员<br/>
                    小小程序员<br/>
                    小小程序员<br/>
                    小小程序员<br/>
                    小小程序员<br/>
                    小小程序员<br/>
                    小小程序员<br/>
                    小小程序员<br/>
                    小小程序员<br/>
                    小小程序员<br/>
                    小小程序员<br/>
                    小小程序员<br/>
                    小小程序员<br/>
                    小小程序员<br/>
                    小小程序员<br/>
                    小小程序员<br/>
                    小小程序员<br/>
                </div>
                <input type=submit value=刷新 onclick="submitRefreshTask()">
            </td>
        </tr>
        
{% if username %}
        <tr bgcolor=#A3A380 align=center>
            <td colspan=2>
                意见|建议<input type=text name=suggest id=suggest>
                <input type=submit value=提交 onclick="submitSuggest()">
            </td>
        </tr>
{% endif %}
        <tr align=center>
            <td colspan=2>
                <marquee behavior=alternate>
                    <a onclick='$(".more").fadeToggle()'>更多可靠性本地工具请点击</a>
                </marquee>
            </td>
        </tr>
        <!-- ################################# 系列小工具 ################################# -->
        <tr class=more style="display:none;">
            <th colspan=2>
                系列小工具
            </th>
        </tr>
        <tr class=more style="display:none;">
            <th>
{% if username %}
                <a href="/">function1</a>
{% else %}
                function 1
{% endif %}
            </th>
            <td>
                description
            </td>
        </tr>
        <tr class=more style="display:none;">
            <th>
{% if username %}
                <a href="/">function1</a>
{% else %}
                function 1
{% endif %}
            </th>
            <td>
                description
            </td>
        </tr>
        <tr class=more style="display:none;">
            <th>
{% if username %}
                <a href="/">function1</a>
{% else %}
                function 1
{% endif %}
            </th>
            <td>
                description
            </td>
        </tr>
        <tr class=more style="display:none;">
            <th>
{% if username %}
                <a href="/">function1</a>
{% else %}
                function 1
{% endif %}
            </th>
            <td>
                description
            </td>
        </tr>
        <tr class=more style="display:none;">
            <th>
{% if username %}
                <a href="/">function1</a>
{% else %}
                function 1
{% endif %}
            </th>
            <td>
                description
            </td>
        </tr>
    </table>
</body>